package com.alipay.sofa.demo.db.provider.serializer;

import com.alipay.sofa.demo.db.common.entity.StudentInfoDTO;
import com.alipay.sofa.demo.db.common.tool.ProtostuffUtil;
import org.apache.kafka.common.serialization.Serializer;

import java.util.Map;

/**
 * @Author Zhang Da
 * @Date 2020/2/15 21:02
 * @Version 1.0
 */
public class StudentInfoSerializer implements Serializer<StudentInfoDTO> {
    @Override
    public void configure(Map<String, ?> map, boolean b) {
        // Do nothing
    }

    @Override
    public byte[] serialize(String topic, StudentInfoDTO data) {
        return ProtostuffUtil.serializer(data, StudentInfoDTO.class);
    }

    @Override
    public void close() {
        // Do nothing
    }
}
